package com.aivin.lib_widget.dialog;

import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.TextView;

import com.aivin.lib_widget.R;
import com.github.ybq.android.spinkit.SpinKitView;
import com.github.ybq.android.spinkit.SpriteFactory;
import com.github.ybq.android.spinkit.Style;
import com.github.ybq.android.spinkit.sprite.Sprite;


public class LoadingDialog extends BaseDialog {
    private TextView tvMsg;

    public LoadingDialog(Context context) {
        super(context);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.lib_widget_waitdialog);
        SpinKitView spinKitView = findViewById(R.id.spinkitview) ;
        Style style = Style.values()[12];
        Sprite drawable = SpriteFactory.create(style);
        spinKitView.setIndeterminateDrawable(drawable);

        tvMsg = findViewById(R.id.tv_msg) ;
    }

    public void setMsg(String msg)  {
        if(tvMsg != null && !TextUtils.isEmpty(msg))   {
            tvMsg.setText(msg);
        }
    }
}
